⚡ Add explicit type field to all SDK clients#175
Conversation
All SDK clients now send 'type' field with screenshot requests: - src/sdk/index.js: type: 'base64' - clients/vitest/src/setup.js: type: 'file-path' - clients/ruby/lib/vizzly.rb: type: 'base64' - clients/swift/Sources/Vizzly/VizzlyClient.swift: type: 'base64' This eliminates O(n) image type detection on the server side, providing significant performance improvement for large screenshots.
Code Review - PR #175SummaryThis PR completes the performance optimization started in #174 by adding the explicit ✅ Strengths
🔍 Minor Observations
🎯 Performance ImpactThis PR completes the optimization that eliminates O(n) regex validation on large base64 strings. For multi-megabyte full-page screenshots, this provides significant speedup as the server can now skip expensive type detection entirely. ✅ RecommendationApprove and merge. The implementation is correct, well-tested at the integration level, and completes the performance optimization from #174. All four SDK clients now benefit from O(1) type detection on the server. Post-merge checklist (as noted in PR description):
Review completed: Code quality ✓, Performance ✓, Security ✓, Test coverage ✓ |
The tests were expecting cloud mode response format (success: true) but the integration tests run against TDD mode which returns status: 'new' or 'match'.
Summary
Adds the
typefield to all SDK clients that send screenshot image data. This completes the performance optimization from #174 by ensuring all clients benefit from O(1) type detection on the server.Changes
src/sdk/index.jstype: 'base64'clients/vitest/src/setup.jstype: 'file-path'clients/ruby/lib/vizzly.rbtype: 'base64'clients/swift/.../VizzlyClient.swifttype: 'base64'No changes needed:
src/client/index.js) - Already updated in ⚡ Skip image type detection when SDK provides explicit type #174Packages to Release
After merging, the following packages need new releases:
@vizzly-testing/cli@vizzly-testing/vitestvizzlyVizzlyTest Plan
typemissing)